/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lectorArchivos;

/**
 *
 * @author gabula
 */
public class LectorDeProblemas {

    private int numNodos;
    private int[][] coord;

    public LectorDeProblemas(String nombre) {
        leerProblema(nombre);
    }

    public void leerProblema(String nombre) {
        try {
            java.io.FileReader i = new java.io.FileReader(new java.io.File(nombre));
            java.io.BufferedReader br = new java.io.BufferedReader(i);
            String s = "";
            s = br.readLine();
            s = br.readLine();
            s = br.readLine();
            s = br.readLine();
            java.util.StringTokenizer str;
            str = new java.util.StringTokenizer(s);
            str.nextToken();
            str.nextToken();
            numNodos = Integer.parseInt(str.nextToken());
            coord = new int[numNodos][2];
            s = br.readLine();
            s = br.readLine();
            for (int k = 0; k < numNodos; ++k) {
                s = br.readLine();
                str = new java.util.StringTokenizer(s);
                str.nextToken();
                for (int j = 0; j < 2; ++j) {
                    String a = str.nextToken();
                    coord[k][j] = (int) Double.parseDouble(a);
                }
            }
            br.close();
        } catch (Exception e) {
            System.out.println("ERROR LECTURA");
            System.out.println(e.getMessage() + " " + e.getCause());
        }
    }

    public int getNumNodos() {
        return numNodos;
    }

    public int[][] getCoord() {
        return coord;
    }

    public void imprimir() {
        System.out.println("Numero de nodos: " + numNodos);
        for (int i = 0; i < coord.length; ++i) {
            System.out.print("nodo: " + (i + 1 + "\t"));
            for (int j = 0; j < coord[i].length; ++j) {
                System.out.print(coord[i][j] + "\t");
            }
            System.out.print("\n");
        }
    }
}
